#ifndef MAIN_APPLICATION_H
#define MAIN_APPLICATION_H

//=============================================================================
//
// Controls:
// - A, D, W, S: Move Camera
// - X, Z: Zoom in, zoom out
//
//=============================================================================

#include "D3DFramework.h"
#include "Light.h"
#include "Sphere.h"

namespace D3D10
{
	class MainApplication : public D3DFramework
	{
	public:
		MainApplication(const HINSTANCE hInstance);
		~MainApplication();
	
		void init();
		void onResize();
		void updateScene(const float deltaTime);
		void drawScene(); 
	
	private:
		void initEffect();
		void initInputLayout();
		void initLights();

		void updateViewMatrix(const float deltaTime);
			
	private:		
		D3D10Shapes::Sphere mSphere;
	
		ID3D10Effect *mEffect;
		ID3D10EffectTechnique *mTechnique;
		ID3D10InputLayout *mInputLayout;

		ID3D10EffectMatrixVariable *mEffectViewProjectionVariable;
		ID3D10EffectMatrixVariable *mEffectWorldVariable;
		ID3D10EffectScalarVariable *mEffectElapsedTimeVariable;
		ID3D10EffectVariable *mEffectEyePosVariable;
		ID3D10EffectVariable *mEffectLightVariable;

		D3DXMATRIX mIcosahedronWorld;

		D3DXMATRIX mView;
		D3DXMATRIX mProjection;
		D3DXMATRIX mViewProjection;

		D3DXVECTOR3 mEyePos;
		
		D3D10Utils::Light mParallelLight;
			
		float mRadius;
		float mTheta;
		float mPhi;

		float mTotalElapsedFrameTimes;
	};
}

#endif // MAIN_APPLICATION_H
